<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>分红式订单 - 胎大王</title>
	{include file='common/head' /}
	<link href="css/jquery.jqzoom.css" rel="stylesheet" type="text/css" />
	<script src="js/layer/layer.js"></script>

</head>
<body>
<div class="container">
{include file='common/top' /}
	<div class="dividend">
		<div class="dividend-banner"></div>
		<div class="contai">
			<div class="f-bk30"></div>
			<div class="dividend-tit">
				<strong>分红式订单</strong>
			</div>
			<p>分红式订单说明：分红式订单不限规格，单个分红式订单最低购买数量为20条，选择不同的分红周期，分红金额不一样，周期越长，分红越高，抢购时需要支付全额货款。</p>
			<div class="f-bk30"></div>
			<div class="dividend-content">
				<div class="dividend-title">
					<strong>TDW产品列表</strong>
					<div class="more">TDW PRODUCT LIST</div>
				</div>
				<div class="f-bk3"></div>
				<div class="tdw-qiehuan">
					<a href="javascript:;" class="act">精品轮胎</a>
					<a href="javascript:;">轮胎配件</a>
				</div>
				<div class="f-bk3"></div>
				<div class="con-list">
					{volist id="vo" name="data['productArray']"}
					<div class="dividend-list">
						<div class="pure-g">
							<div class="pure-u-5-24">
								<a href="/dividendDetail.html?id={$vo.id}"><img src="{$vo.img}" alt="{$vo.name}"></a>
							</div>
							<div class="pure-u-19-24" style="position: relative;">
								<div class="info">
									<a href="/dividendDetail.html?id={$vo.id}"><p>{$vo.name}</p></a>
								</div>
								<div class="price">
									￥{$vo.price}
								</div>
								<div class="type-list">
								<ul>
									<li>·规格：{$vo.spec}</li>
									<li>·花纹：{$vo.huawen}</li>
									<li>·轮位：{$vo.position}</li>
								</ul>
							</div>

								<div class="type">
									<ul class="list-th">
										<li class="list-top">周期：</li>
										<li>分红：</li>
										<li>库存：</li>
									</ul>
									{volist name="$vo['poolInfo']" id="v"}
									<ul>
										<li class="list-top">{$v.cycle}天</li>
										<li>{$v.radix}元/条</li>
										<li>{$v.quantity}条</li>
									</ul>
									{/volist}
								</div>
								<div class="dividend-botton">
									<ul>
										<li><div class="num">· 抢购数量 <span class="reduc">&nbsp;-&nbsp;</span><input name="numinput" class="numinput" type="text" id="text_box" value="1" /><span class="add">+</div></li>
										<li>
											<input type="hidden" value="{$vo.id}" name='productId' />
											<div class="umall">
											<a href="javascript:;" class="addCart">加入购物车</a> 
											<a href="javascript:;" class="buy">立即抢购</a>
											</div>
										</li>
									</ul>
								</div>
							</div>
						</div>
					</div>
					{/volist}
				</div>
				<div class="con-list hide">
				{empty name="data['partsArray']"}
				  <div style="text-align:center;padding: 5rem 0;">
					<img src="__IMG__/success.png">
					<p style="color: #ec6c00;">暂无配件</p>
				  </div>
				{else /}
				{volist id="vo" name="data['partsArray']"}
					<div class="dividend-list">
						<div class="pure-g">
							<div class="pure-u-5-24">
								<a href="/dividendDetail.html?id={$vo.id}"><img src="{$vo.img}" alt="{$vo.name}"></a>
							</div>
							<div class="pure-u-19-24" style="position: relative;">
								<div class="info">
									<a href="/dividendDetail.html?id={$vo.id}"><p>{$vo.name}</p></a>
								</div>
								<div class="price">
									￥{$vo.price}
								</div>
								<div class="type-list">
								<ul>
									<li> </li>
	
								</ul>
							</div>

								<div class="type">
									<ul class="list-th">
										<li class="list-top">周期：</li>
										<li>分红：</li>
										<li>库存：</li>
									</ul>
									{volist name="$vo['poolInfo']" id="v"}
									<ul>
										<li class="list-top">{$v.cycle}天</li>
										<li>{$v.radix}元/箱</li>
										<li>{$v.quantity}箱</li>
									</ul>
									{/volist}
								</div>
								<div class="dividend-botton">
									<ul>
										<li><div class="num">· 抢购数量 <span class="reduc">&nbsp;-&nbsp;</span><input name="numinput" class="numinput" type="text" id="text_box" value="1" /><span class="add">+</div></li>
										<li>
											<input type="hidden" value="{$vo.id}" name='productId' />
											<div class="umall">
											<a href="javascript:;" class="addCart">加入购物车</a> 
											<a href="javascript:;" class="buy">立即抢购</a>
											</div>
										</li>
									</ul>
								</div>
							</div>
						</div>
					</div>
				{/volist}
				{/empty}
				</div>
		</div>
	</div>
	{include file='common/foot' /}
</div>
{include file='common/back' /}
<script>
$(function(){
	$(".reduc").each(function() {
		$(this).click(function() {
			var $multi1 = 0;
			var vall1 = $(this).next().val();
			vall1--;
			if(vall1 <= 0) {
				vall1 = 1;
			}
			$(this).next().val(vall1);
		})
	});
	$(".add").each(function() {
		$(this).click(function() {
			var $multi = 0;
			var vall = parseInt($(this).prev().val());
			vall++;
			$(this).prev().val(vall);
		})
	});
	$(".addCart").click(function(){
		var quantity = $(this).closest("ul").find("input[name='numinput']").val();
		var productId = $(this).parents("li").find("input[name='productId']").val();
		if (/^\d*[1-9]\d*$/.test(quantity) && parseInt(quantity) > 0) {
			$.ajax({
				url: "/Cart/addCart.html",
				type: "POST",
				data: {id:productId,quantity:quantity},
				dataType: "json",
				cache: false,
				success: function(data) {
					if(data.code==1){
						layer.msg("添加成功",{time:1500});
					}else if(data.code==1004){
						layer.alert(data.msg,function(){
							window.location.href='/login/jump/dividend.html';					
						});						
					}else{
						layer.msg(data.msg,{time:1500});
					}
				}
			});
		} else {
			layer.msg("加入购物车失败",{time:1500});
		}
	});
	$(".buy").click(function(){
		var quantity = $(this).closest("ul").find("input[name='numinput']").val();
		var productId = $(this).parents("li").find("input[name='productId']").val();
		if (/^\d*[1-9]\d*$/.test(quantity) && parseInt(quantity) > 0) {
			$.ajax({
				url: "/Cart/addCart.html",
				type: "POST",
				data: {id:productId,quantity:quantity},
				dataType: "json",
				cache: false,
				success: function(data) {
					if(data.code==1){
						//layer.alert("添加成功",function(){
							window.location.href='/cart.html';					
						//});	
					}else if(data.code==1004){
						layer.alert(data.msg,function(){
							window.location.href='/login/jump/dividend.html';					
						});						
					}else{
						layer.msg(data.msg,{time:1500});
					}
				}
			});
		} else {
			layer.msg("购买失败",{time:1500});
		}
	});

	//切换
  tabs($(".tdw-qiehuan a"), $('.con-list'));
	
});
var tabs = function(tab, con){
	    tab.click(function(){
	        var indx = tab.index(this);
	        tab.removeClass('act');
	        $(this).addClass('act');
	        con.hide();
	        con.eq(indx).show();
	    })    
	}
</script>
</body>
</html>